from graphlitedb import database as db
import json

class SqliteDrv:
    def __init__(self, path):
        self.conn = path
        db.initialize(self.conn)
        # self.idnow = 0

    # def newid(self):
    #     self.idnow+=1
    #     yield self.idnow
        
    def createTag(self, mod):
        pass
    def getTag(self, tagname):
        return None
    def getTags(self):
        return None

    def delTag(self, tagname):
        return None

    def createRef(self, rmod):
        pass

    def createNode(self, nodetype, name=None, tags=None, data=None):
        return db.add_node(json.loads(data.json()))

    def updateNode(self, nodeid, **args):
        pass

    def getNodes(self, nodetype, **args):
        return None

    def createEdge(self, edgetype, node1name, node2name):
        return db.connect_nodes(node1name, node2name)

    def getEdge(self, etype, src, tar):
        return None

    def di(self, nid):
        return None

    def query(self, q):
        return #self._graph.search(q)

    def plot(self):
        pass